import { Template } from 'meteor/templating';

import './posts.html';

const postsData = [
	{
    title: 'Introducing Telescope',
    url: 'http://sachagreif.com/introducing-telescope/'
  }, 
  {
    title: 'Meteor',
    url: 'http://meteor.com'
  }, 
  {
    title: 'The Meteor Book',
    url: 'http://themeteorbook.com'
  }
];

Template.postsList.helpers({
	posts() {
		return postsData;
	}
});

Template.postsItem.helpers({
	domain() {
		const a = document.createElement('a');
		a.href = this.url;
		return a.hostname;
	}
});